<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FIRST LEGO League na Slovensku - FLL na Slovensku</title>
<base href="http://www.fll.sk/" />
<link href="http://kempelen.ii.fmph.uniba.sk/letnaliga/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>

	<div id = 'hlava_zadania'>
	
	<h2>Zadanie: 
		<?php 
			$zadanie = $zadanie[0];
			echo $zadanie->name;
			$today = date("Y-m-d H:i:s");
		?> 
	</h2>
	
	<?php
	if (($zadanie->end != '0000-00-00 00:00:00') && ($zadanie->start <= $today)){
	?> 
	
		<h4> čas zadania:<?php echo $zadanie->start; ?> </h4>
		<h4> čas ukončenia:<?php echo $zadanie->end; ?> </h4>		
		
	<?php	
	}
	
	else {
	?>
	
		<h4> Vložte čas vo formáte rok-mesiac-deň h:m:s </h4>
		<p>(Ak nastane čas zadania a ak čas ukončenia bude až po čase zadania, tak sa zadanie stane aktívnym)</p>
		<?php
			
			echo form_open("projekt/update_time/{$zadanie->id}");
			
			echo form_label('čas štartu', 'start');
			echo form_input('start',set_value('start'));
			
			echo form_label('čas ukončenia', 'end');
			echo form_input('end',set_value('end'));
			
			echo form_submit('submit', 'Vlož časy');
			
			echo form_close();
			
			
			
			
			
			echo '<h4> Upraviť zadanie: </h4>';
			
			echo form_open("projekt/edit_mission/{$zadanie->id}");
			
			$data = array(
					'name'  => 'zadanie',
					'value' => $zadanie->content,
					'rows'  => '5',					
				);
				
			echo form_textarea($data);
			
			echo form_submit('submit', 'Upraviť');
			
			echo form_close();

			?>

			<?php echo form_open_multipart('projekt/do_upload');?>
            <table>
                <tr>
                    <td><label for="file">Vyberte obrázok</label></td>
                    <td><input id="file" type="file" name="userfile" size="20" /></td>
                    <td><?php echo form_submit('obrazok', 'Upload!'); ?></td>
                </tr>
            </table>
        </form>
        <h2>Obrázky k dispozícii pre vytváranie zadania:</h2>
        <ul>
            <?php if(!empty($obrazky)) { 
                foreach($obrazky as $obr){ 
                    echo '<li>http://kempelen.ii.fmph.uniba.sk/letnaliga/attachments/'.$obr.' - <a href="'.base_url('projekt/delete_attachment/'.$obr).'">Vymazať</a></li>';             } 
            } ?>
        </ul>
			
		
	<?php
	}
	?>
		
	</div>
	<div id = 'content'>
	<?php echo $zadanie->content; ?>
	</div>
	<?php 
	
		if ($today < $zadanie->end && $today > $zadanie->start) {
			
			?>
			
			<a href="<?php echo site_url("solution_control/index/{$zadanie->id}"); ?>"> Pridať riešenie </a>

	
	<div id = 'riesenia'>
	
		<h3>Riešenia:</h3>
			<ul>
			
			<?php 		
		}
	
				
				
				foreach ($riesenie as $obj) {
				
					?>
					<li>
						<a href="<?php echo site_url("projekt/show_solution/{$obj->id}"); ?>"> 
							<?php 
								$q = $this->db->where('id', $obj->uid)
											  ->get('users');
								$usr = $q->result();
								
								echo $usr[0]->name;
								if ($obj->win) {
									echo "(Výherné riešenie)"; 
								}								
								
							?> 
						</a>
					</li>
					<?php
				}
				
				?>
			</ul>
	</div>
	
	<a href="<?php echo site_url('projekt/logged');?>"> Späť na zadania </a>
	<?php
	if ($this->session->userdata('logged_in') != 0 ) {

		?>
		<div id = 'logout_butt'>
		<a href="<?php echo site_url('auth/logout'); ?>"> Logout </a>
		</div>
		<?php
	}
	?>
</body>
</html>